package com.example.factory;

import com.example.strategy.LoginStrategy;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Component
public class UserLoginFactory {
    @Resource
    private  Map<String, LoginStrategy> loginStrategyMap = new HashMap<>();

    /**
     * 对外提供获取具体策略
     *
     * @param loginType 用户的登录方式，需要跟配置文件中匹配
     * @return 具体策略
     */
    public LoginStrategy getGranter(String loginType) {
        return loginStrategyMap.get(loginType);
    }
}
